<template>
  <div class="child2">
    这是child2组件
    <!-- <h1>这是child2---{{ child2Value }}</h1> -->
    <h1>这是child2---{{$store.state.count}}</h1>
    <el-button @click="child2Add">child2自增</el-button>
  </div>
</template>

<style scoped lang="scss">
.child2 {
  width: 300px;
  height: 200px;
  border: 2px solid red;
}
</style>

<script>
export default {
  methods: {
    child2Add() {
        // this.$emit("update:child2Value",this.child2Value+1)
         this.$store.commit("addCount")
    },
  },
  props: {
    child2Value: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {};
  },
};
</script>